import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Home from '../views/Home.vue'
import ArticleList from '../views/ArticleList.vue'
import PostArticle from '../views/PostArticle.vue'
import BlogDetail from '../views/BlogDetail.vue'
import UserManager from '../views/UserManager.vue'
import CateManager from '../views/CateManager.vue'
import DataCharts from '../views/DataCharts.vue'

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        name: '登录',
        component: Login,
        hidden: true
    }, {
        path: '/home',
        name: '首页',
        component: Home,
        hidden: true,
    }, {
        path: '/home',
        name: '文章管理',
        component: Home,
        iconClass: 'fa fa-file-text-o',
        children: [
            {
                path: '/articleList',
                name: '文章列表',
                component: ArticleList,
                meta: {
                    keepAlive: true
                }
            },
            {
                path: '/postArticle',
                name: '发表文章',
                component: PostArticle,
                meta: {
                    keepAlive: false
                }
            },
            {
                path: '/blogDetail',
                name: '博客详情',
                component: BlogDetail,
                hidden: true,
                meta: {
                    keepAlive: false
                }
            },
            {
                path: '/editBlog',
                name: '编辑博客',
                component: PostArticle,
                hidden: true,
                meta: {
                    keepAlive: false
                }
            }
        ]
    }, {
        path: '/home',
        component: Home,
        name: '用户管理',
        children: [
            {
                path: '/user',
                iconClass: 'fa fa-user-o',
                name: '用户管理',
                component: UserManager
            }
        ]
    }, {
        path: '/home',
        component: Home,
        name: '栏目管理',
        children: [
            {
                path: '/cateMana',
                iconClass: 'fa fa-reorder',
                name: '栏目管理',
                component: CateManager
            }
        ]
    }, {
        path: '/home',
        component: Home,
        name: '数据统计',
        iconClass: 'fa fa-bar-chart',
        children: [
            {
                path: '/charts',
                iconClass: 'fa fa-bar-chart',
                name: '数据统计',
                component: DataCharts
            }
        ]
    }
];

const router = new VueRouter({
    routes
});

export default router
